<?php
//判断用户是否登录
session_start();
if(isset($_SESSION['managerInfo'])){
	//用户已经登录
} else {
	//跳转到登录界面
	header("Location:http://localhost/SelectCoursesSystem/RegisterLogin.php");
}
/* if(!defined('APP')) die('error!'); */
?>
<?php
	require_once dirname(__FILE__).'/../../controller/SuperManagerController.class.php';
?>	
<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<title>欢迎进入学生选课系统(超级管理员)</title>	
	</head>
	<link rel="stylesheet" href="../../css/student_view.css" type="text/css"/>
	<link rel="stylesheet" href="../../css/manager_view.css" type="text/css">
	<link rel="stylesheet" href="../../css/course_reviese_view.css" type="text/css">
	<link rel="stylesheet" href="../../css/model.css" type="text/css">
	<body>
		<!-- 标题头 -->
		<div class="main_head_class">
			<div class="main_head_show_class">
				<p>欢迎您进入学生选课系统</p>
			</div>
		</div>
		<!-- 背景面板 -->
		<div class="main_student_info_class">
			<!-- 管理员信息 -->
			<div class="student_info_class">
				<!-- 头像以及头像背景图 -->
				<div class="student_info_head_class">
					<!-- 头像上背景颜色 -->
					<div class="student_info_head_first">
					</div>
					<div class="student_info_head_img_class">
						<img alt="" src="../../images/head.jpg">
					</div>
				</div>
				<!-- 对于管理员(增加、修改、删除、查找)的操作 -->
				<div class="student_operator_class">
					<ul>
						<li><p class="IAmSuper_class">(我是超级管理员)</p>
						<li><a href="./SuperManagerView.php">查看管理员信息</a></li>
						<li><a href="./SuperManagerView.php?operation=allow&object=manager&courseOrStudentId=sure">审核管理员信息</a>
						<li><a href="javascript:void(0)">新增管理员信息</a></li>
					</ul>
				</div>
			</div>
			<!-- 课程对应的选课信息 -->
			<div class="main_student_courses_info">
				<div class="student_courses_info_backgroud">
					<div class="student_courses_info">
						<!-- 根据参数(操作[operation]、对象[object]、唯一标识参数[courseOrStudentId])显示不同界面 -->
						<?php 
							//获取参数(操作、对象、唯一标识参数)
							$operation = isset($_GET['operation']) ? $_GET['operation'] : "";
							$object = isset($_GET['object']) ? $_GET['object'] : "";
							$courseOrStudentId= isset($_GET['courseOrStudentId']) ? $_GET['courseOrStudentId'] : "";
							
							$superManagerController = new SuperManagerController();
							if($operation === "" || $object === "" || $courseOrStudentId === ""){
								//所有管理员信息
								require_once dirname(__FILE__).'/ShowSuperManagerOperationView.php';					
							} else if($operation === 'delete' && $object === 'manager'){
								//删除管理员信息
								$superManagerController->deleteManager($courseOrStudentId);
								header("Location:http://localhost/SelectCoursesSystem/view/manager/SuperManagerView.php");
							} else if($operation === 'allow' && $object === 'manager' && $courseOrStudentId === 'sure'){
								//审核
								require_once dirname(__FILE__).'/AllowManagerView.php';
							} 
							?>
					</div>
				</div>
			</div>	
		</div>
	</body>
</html>